<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DateTime</title>
</head>
<body>
<script src="../../../lib/baitu.min.js"></script>
<script>
    const {DateTime, WeekDay, DateField} = Baitu;
    console.log(new DateTime())
    console.log(DateTime.create())
    console.log(DateTime.create(1710400022302))
    console.log(DateTime.create(2024, 3, 14, 15, 7, 30))
    console.log(DateTime.create(2024, 3, 14))
    console.log(new Date(2024, 3, 14))

    const nowDateTime = DateTime.create();
    console.log(nowDateTime.objectValues())
    console.log(nowDateTime.toDate())
    console.log(nowDateTime.format('yyyy-MM-dd HH:mm:ss'))
    console.log(nowDateTime.format('yyyy-MM-dd'))
    console.log(nowDateTime.format())
    console.log(nowDateTime.formatDate())
    console.log(nowDateTime.formatDateTime())
    console.log(nowDateTime.beginOfDay())
    console.log(nowDateTime.endOfDay())
    console.log(nowDateTime.beginOfWeek())
    console.log(nowDateTime.endOfWeek())
    nowDateTime.setFirstWeek(WeekDay.MON)
    console.log(nowDateTime.beginOfWeek())
    console.log(nowDateTime.endOfWeek())
    console.log(nowDateTime.beginOfMonth())
    console.log(nowDateTime.endOfMonth())
    console.log(nowDateTime.beginOfYear())
    console.log(nowDateTime.endOfYear())
    console.log(nowDateTime.offset(DateField.YEAR, 3))
    const dateTime = DateTime.create(2024, 1, 29, 15, 20, 10);
    console.log(dateTime.offset(DateField.YEAR, 1))
    console.log(nowDateTime.offset(DateField.MONTH, 6).formatDate())
    console.log(nowDateTime.daysOfMonth())
    console.log(dateTime.daysOfMonth())
    console.log(nowDateTime.daysOfYear())
    const dateTime2 = DateTime.new(2023, 1, 19, 15, 20, 10);
    console.log("11", dateTime2)
    console.log(dateTime2.daysOfYear())
    console.log(nowDateTime.isLeapYear())
    console.log(dateTime2.isLeapYear())
    console.log("年", nowDateTime.compare(dateTime2, DateField.YEAR))
    console.log("-年",dateTime2.compare(nowDateTime, DateField.YEAR))
    console.log("月",nowDateTime.compare(dateTime2, DateField.MONTH))
    console.log("-月",dateTime2.compare(nowDateTime, DateField.MONTH))
    console.log("日",nowDateTime.compare(dateTime2, DateField.DAY))
    console.log("-日",dateTime2.compare(nowDateTime, DateField.DAY))
    console.log("星期",nowDateTime.compare(dateTime2, DateField.WEEK))
    console.log("-星期",dateTime2.compare(nowDateTime, DateField.WEEK))
    console.log("时",nowDateTime.compare(dateTime2, DateField.HOURS))
    console.log("-时",dateTime2.compare(nowDateTime, DateField.HOURS))
    console.log("分",nowDateTime.compare(dateTime2, DateField.MINUTES))
    console.log("-分",dateTime2.compare(nowDateTime, DateField.MINUTES))
    console.log("秒",nowDateTime.compare(dateTime2, DateField.SECONDS))
    console.log("-秒",dateTime2.compare(nowDateTime, DateField.SECONDS))
    console.log("毫秒",nowDateTime.compare(dateTime2))
    console.log("-毫秒",dateTime2.compare(nowDateTime))

    const birDay = DateTime.new(1999, 3, 16);
    console.log(birDay.age());
    console.log(birDay.yearMonthNumber())
    console.log(birDay.yearMonthDayNumber())
</script>
</body>
</html>
